package com.qf.voterabbitmqcustomer.config;

import org.springframework.amqp.core.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author 刘欣
 * @createTime 2023/3/2 17:04
 * @description
 */
@Configuration
public class RabbitConfig {

    @Bean
    public FanoutExchange getTopicExchange() {

        FanoutExchange fanoutExchange = new FanoutExchange("vote_exchange", true, false);
        return fanoutExchange;
    }

    @Bean
    public Queue getQueue() {
        Queue queue = new Queue("queue_vote");
        return queue;
    }

    @Bean
    public Binding binding(FanoutExchange fanoutExchange, Queue queue) {
        return BindingBuilder.bind(queue).to(fanoutExchange);
    }

}
